package com.stoneframe.base.netty;

import com.stoneframe.base.util.Logger;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.channel.socket.DatagramPacket;
import io.netty.handler.timeout.ReadTimeoutException;

public class ServerUDPHandler extends ChannelInboundHandlerAdapter {
	
	private static final Logger logger=Logger.getLogger(ServerUDPHandler.class);
	
	public ServerUDPHandler(){
		super();
	}

	@Override
	public void channelRead(ChannelHandlerContext ctx, Object msg)
			throws Exception {
		// TODO Auto-generated method stub
		DatagramPacket dpaket=(DatagramPacket)msg;
		logger.info("开始处理数据");
	}

	@Override
	public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause)
			throws Exception {
		// TODO Auto-generated method stub
		if(cause instanceof ReadTimeoutException){
			
		}else{
			ctx.channel().close();
		}
	}
	
	

}
